﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    xmlns:r="clr-namespace:Wpf.Controls;assembly=Wpf.TabControl"
	x:Class="Window1"
	x:Name="ChatWindow"
	Title="MChat Alpha"
	Width="573" Height="513" ResizeMode="CanResizeWithGrip" OpacityMask="{x:Null}" Opacity="1" WindowStartupLocation="CenterScreen" WindowState="Normal" xmlns:mchatstart="clr-namespace:mchatstart" ShowInTaskbar="True" Foreground="#FF0E0000" Background="{DynamicResource ToolbarBGBrush}" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" AllowsTransparency="False" WindowStyle="None">
	<Window.Resources>
		<LinearGradientBrush x:Key="TopRectBrush" EndPoint="0.5,1" StartPoint="0.5,0">
			<GradientStop Color="#FFCECECF" Offset="0"/>
			<GradientStop Color="#FFB1B1B1" Offset="1"/>
			<GradientStop Color="#FFCFCFCF" Offset="0"/>
		</LinearGradientBrush>
		<LinearGradientBrush x:Key="ToolbarBGBrush" EndPoint="0.5,1" StartPoint="0.5,0">
			<GradientStop Color="#FF969696" Offset="0"/>
			<GradientStop Color="#FFA6A6A6" Offset="1"/>
		</LinearGradientBrush>
		<SolidColorBrush x:Key="TreeviewBrush" Color="#FFD6DDE5"/>
		<SolidColorBrush x:Key="LightBrush" Color="#FF5A5A5A"/>
		<SolidColorBrush x:Key="SolidBorderBrush" Color="#888"/>
		<SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#FF646464"/>
		<SolidColorBrush x:Key="DisabledBorderBrush" Color="#FFFFCF74"/>
		<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888"/>		
		<Style x:Key="SimpleTabItem" d:IsControlPart="True" TargetType="{x:Type TabItem}">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type TabItem}">
						<Grid Height="23" Margin="0,15,0,0">
							<Border Margin="0,0,-4,0" x:Name="Border" Background="{DynamicResource ToolbarBGBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1,1,1,1">
								<ContentPresenter HorizontalAlignment="Center" Margin="12,2,12,2" x:Name="ContentSite" VerticalAlignment="Center" RecognizesAccessKey="True" Height="15" ContentSource="Header"/>
							</Border>
						</Grid>
						<ControlTemplate.Triggers>
							<Trigger Property="IsSelected" Value="True">
								<Setter Property="Foreground" Value="#FFFFFFFF"/>
								<Setter Property="Panel.ZIndex" Value="100"/>
								<Setter Property="BorderBrush" Value="#FFFFCF01" TargetName="Border"/>
								<Setter Property="BorderThickness" Value="1,1,1,0" TargetName="Border"/>
							</Trigger>
							<Trigger Property="IsEnabled" Value="False">
								<Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
								<Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
								<Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>		
		</Style>
		<Style x:Key="SimpleTabNewMsg" d:IsControlPart="True" TargetType="{x:Type TabItem}">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type TabItem}">
						<Grid Height="23" Margin="0,15,0,0">
							<Border Margin="0,0,-4,0" x:Name="Border" Background="{DynamicResource ToolbarBGBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1,1,1,1">
								<ContentPresenter HorizontalAlignment="Center" Margin="12,2,12,2" x:Name="ContentSite" VerticalAlignment="Center" RecognizesAccessKey="True" Height="15" ContentSource="Header"/>
							</Border>
						</Grid>
						<ControlTemplate.Triggers>
							<Trigger Property="IsSelected" Value="True">
								<Setter Property="Foreground" Value="#FFFF0000"/>
								<Setter Property="Panel.ZIndex" Value="100"/>
								<Setter Property="BorderBrush" Value="#FFFFCF01" TargetName="Border"/>
								<Setter Property="BorderThickness" Value="1,1,1,0" TargetName="Border"/>
							</Trigger>
							<Trigger Property="IsSelected" Value="False">
								<Setter Property="Foreground" Value="#FFFF0000"/>								
							</Trigger>
							<Trigger Property="IsEnabled" Value="False">
								<Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
								<Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
								<Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>		
		</Style>
		<SolidColorBrush x:Key="TabBGColor" Color="#FF000000"/>
		<LinearGradientBrush x:Key="HoverBrush" EndPoint="1,0.5" StartPoint="0,0.5">
			<GradientStop Color="#FFFFFEE3" Offset="0"/>
			<GradientStop Color="#FFFFE797" Offset="0.26"/>
			<GradientStop Color="#FFFFD734" Offset="0.545"/>
			<GradientStop Color="#FFFFE796" Offset="0.955"/>
		</LinearGradientBrush>
		<Style x:Key="SimpleButton" TargetType="{x:Type Button}" BasedOn="{x:Null}">
			<!-- Setter Property="FocusVisualStyle" Value="{DynamicResource SimpleButtonFocusVisual}"/-->
			<Setter Property="Background" Value="#FF535353"/>
			<Setter Property="BorderBrush" Value="#FF535353"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Button}">
					
						<!-- We use Grid as a root because it is easy to add more elements to customize the button -->
						<Grid x:Name="Grid" Width="Auto" Height="18.36">
							<Border x:Name="Border" Background="{x:Null}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"/>
						
							<ContentPresenter HorizontalAlignment="Center" Margin="4.958,1,1.958,4.4" VerticalAlignment="Stretch" RecognizesAccessKey="True" Height="Auto" d:LayoutOverrides="VerticalAlignment"/>
						
							<!-- Content Presenter is where the text content etc is placed by the control -->
						</Grid>
					
						<!--Each state sets a brush on the Border in the template -->
						<ControlTemplate.Triggers>
							<Trigger Property="IsKeyboardFocused" Value="true">
							
								<!-- Setter Property="BorderBrush" Value="{DynamicResource DefaultedBorderBrush}" TargetName="Border"/-->
							</Trigger>
							<Trigger Property="IsMouseOver" Value="true">
								<Setter Property="BorderBrush" Value="#FFFFCF01" TargetName="Border"/>
							</Trigger>
							<Trigger Property="IsPressed" Value="true">
								<Setter Property="Foreground" Value="#FF000000"/>
								<Setter Property="Background" Value="{DynamicResource HoverBrush}" TargetName="Border"/>
								<Setter Property="BorderBrush" Value="{DynamicResource HoverBrush}" TargetName="Border"/>
							</Trigger>
							<Trigger Property="IsEnabled" Value="true"/>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
								<Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
								<Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="TabControlClose" TargetType="{x:Type TabControl}">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type TabControl}">
						<Grid KeyboardNavigation.TabNavigation="Local">
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto"/>
								<RowDefinition Height="*"/>
							</Grid.RowDefinitions>
						
							<TabPanel Grid.Row="0" Margin="0,0,26,0" x:Name="HeaderPanel" Background="Transparent" IsItemsHost="True" Panel.ZIndex="1" KeyboardNavigation.TabIndex="1" Height="21.96" VerticalAlignment="Top" d:LayoutOverrides="VerticalAlignment" RenderTransformOrigin="0.5,0.5">
								<TabPanel.RenderTransform>
									<TransformGroup>
										<ScaleTransform ScaleX="1" ScaleY="1"/>
										<SkewTransform AngleX="0" AngleY="0"/>
										<RotateTransform Angle="0"/>
										<TranslateTransform X="0" Y="0"/>
									</TransformGroup>
								</TabPanel.RenderTransform>
							</TabPanel>
						
							<Border Grid.Row="1" x:Name="Border" Background="{DynamicResource ToolbarBGBrush}" BorderBrush="#FFFFCF01" BorderThickness="1" CornerRadius="2" KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabNavigation="Local" KeyboardNavigation.TabIndex="2" Margin="0,-4,0,0">
							
								<!-- The implementation switches the content. This control must be named PART_SelectedContentHost -->
								<ContentPresenter Margin="4" x:Name="PART_SelectedContentHost" ContentSource="SelectedContent"/>
							
							</Border>
							<Button HorizontalAlignment="Right" Margin="0,1,5,7" Style="{DynamicResource SimpleButton}" VerticalAlignment="Stretch" Width="16.623" Content="X" d:LayoutOverrides="Height" x:Name="CTabButton" Click="CTabButton_Click" Foreground="#FFFFFFFF" BorderThickness="1,1,1,1"/>
						</Grid>					
						<ControlTemplate.Triggers>
							<Trigger Property="IsEnabled" Value="False">
								<Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
								<Setter Property="BorderBrush" Value="#FFFFCF01" TargetName="Border"/>
							</Trigger>
						</ControlTemplate.Triggers>
				
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Setter Property="Background" Value="#FF535353"/>
			<Setter Property="Foreground" Value="#FFFFFFFF"/>
		</Style>
		<Storyboard x:Key="HideFrame"/>
		<Storyboard x:Key="ShowFrame"/>
		<Storyboard x:Key="ShowFeeds"/>
		<Storyboard x:Key="HideFeeds"/>
	
		<Style x:Key="ChanCenterTC" TargetType="{x:Type TabControl}">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type TabControl}">
						<Grid KeyboardNavigation.TabNavigation="Local">
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto"/>
								<RowDefinition Height="*"/>
							</Grid.RowDefinitions>
						
							<TabPanel Grid.Row="0" Margin="0,0,26,0" x:Name="HeaderPanel" Background="Transparent" IsItemsHost="True" Panel.ZIndex="1" KeyboardNavigation.TabIndex="1" Height="21.96" VerticalAlignment="Top" d:LayoutOverrides="VerticalAlignment" RenderTransformOrigin="0.5,0.5">
								<TabPanel.RenderTransform>
									<TransformGroup>
										<ScaleTransform ScaleX="1" ScaleY="1"/>
										<SkewTransform AngleX="0" AngleY="0"/>
										<RotateTransform Angle="0"/>
										<TranslateTransform X="0" Y="0"/>
									</TransformGroup>
								</TabPanel.RenderTransform>
							</TabPanel>
						
							<Border Grid.Row="1" x:Name="Border" Background="{DynamicResource ToolbarBGBrush}" BorderBrush="#FFFFCF01" BorderThickness="1" CornerRadius="2" KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabNavigation="Local" KeyboardNavigation.TabIndex="2" Margin="0,-4,0,0">
							
								<!-- The implementation switches the content. This control must be named PART_SelectedContentHost -->
								<ContentPresenter Margin="4" x:Name="PART_SelectedContentHost" ContentSource="SelectedContent"/>
							
							</Border>
						</Grid>					
						<ControlTemplate.Triggers>
							<Trigger Property="IsEnabled" Value="False">
								<Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
								<Setter Property="BorderBrush" Value="#FFFFCF01" TargetName="Border"/>
							</Trigger>
						</ControlTemplate.Triggers>
				
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Setter Property="Background" Value="#FF535353"/>
			<Setter Property="Foreground" Value="#FFFFFFFF"/>
		</Style>
		<Style x:Key="OptsButt" TargetType="{x:Type Button}" BasedOn="{x:Null}">
			<!-- Setter Property="FocusVisualStyle" Value="{DynamicResource SimpleButtonFocusVisual}"/-->
			<Setter Property="Background" Value="#FF535353"/>
			<Setter Property="BorderBrush" Value="#FF535353"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Button}">
					
						<!-- We use Grid as a root because it is easy to add more elements to customize the button -->
						<Grid x:Name="Grid" Width="Auto" Height="18">
							<Border x:Name="Border" Background="{x:Null}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"/>
						
							<ContentPresenter HorizontalAlignment="Center" Margin="6,0,6,0" VerticalAlignment="Center" RecognizesAccessKey="True" Height="Auto"/>
						
							<!-- Content Presenter is where the text content etc is placed by the control -->
						</Grid>
					
						<!--Each state sets a brush on the Border in the template -->
						<ControlTemplate.Triggers>
							<Trigger Property="IsKeyboardFocused" Value="true">
							
								<!-- Setter Property="BorderBrush" Value="{DynamicResource DefaultedBorderBrush}" TargetName="Border"/-->
							</Trigger>
							<Trigger Property="IsMouseOver" Value="true">
								<Setter Property="BorderBrush" Value="#FFFFCF01" TargetName="Border"/>
							</Trigger>
							<Trigger Property="IsPressed" Value="true">
								<Setter Property="Foreground" Value="#FF000000"/>
								<Setter Property="Background" Value="{DynamicResource HoverBrush}" TargetName="Border"/>
								<Setter Property="BorderBrush" Value="{DynamicResource HoverBrush}" TargetName="Border"/>
							</Trigger>
							<Trigger Property="IsEnabled" Value="true"/>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
								<Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
								<Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="LVButt" TargetType="{x:Type Button}" BasedOn="{x:Null}">
			<!-- Setter Property="FocusVisualStyle" Value="{DynamicResource SimpleButtonFocusVisual}"/-->
			<Setter Property="Background" Value="#FF535353"/>
			<Setter Property="BorderBrush" Value="#FF535353"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Button}">
					
						<!-- We use Grid as a root because it is easy to add more elements to customize the button -->
						<Grid x:Name="Grid" Width="Auto" Height="Auto">
							<Border x:Name="Border" Background="{x:Null}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"/>
						
							<ContentPresenter HorizontalAlignment="Center" Margin="6.958,34,5.958,-1.6" VerticalAlignment="Center" RecognizesAccessKey="True" Height="Auto"/>
						
							<Image HorizontalAlignment="Stretch" Margin="0,0,-3,23" VerticalAlignment="Stretch" Width="32" Source="..\Images\edit-paste.png" Stretch="Fill"/>
						
							<!-- Content Presenter is where the text content etc is placed by the control -->
						</Grid>
					
						<!--Each state sets a brush on the Border in the template -->
						<ControlTemplate.Triggers>
							<Trigger Property="IsKeyboardFocused" Value="true">
							
								<!-- Setter Property="BorderBrush" Value="{DynamicResource DefaultedBorderBrush}" TargetName="Border"/-->
							</Trigger>
							<Trigger Property="IsMouseOver" Value="true">
								<Setter Property="BorderBrush" Value="#FFFFCF01" TargetName="Border"/>
							</Trigger>
							<Trigger Property="IsPressed" Value="true">
								<Setter Property="Foreground" Value="#FF000000"/>
								<Setter Property="Background" Value="{DynamicResource HoverBrush}" TargetName="Border"/>
								<Setter Property="BorderBrush" Value="{DynamicResource HoverBrush}" TargetName="Border"/>
							</Trigger>
							<Trigger Property="IsEnabled" Value="true"/>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
								<Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
								<Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	
	</Window.Resources>
	
	<Grid x:Name="LayoutRoot">
		<Border Margin="-1,-1,0,0" VerticalAlignment="Top" Height="22.25" CornerRadius="5,4,0,0" BorderBrush="#00505050" BorderThickness="1,1,1,0" x:Name="Titlebar">
			<Border.Background>
				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
					<GradientStop Color="#FF969696" Offset="1"/>
					<GradientStop Color="#FFC2C2C2" Offset="0"/>
				</LinearGradientBrush>
			</Border.Background>
			<TextBlock Width="311.847" Height="21" Text="" TextWrapping="Wrap" x:Name="Tblabel" Foreground="#FF0A0101" TextTrimming="WordEllipsis" TextAlignment="Center"/>
		</Border>
		<Image HorizontalAlignment="Right" Margin="0,3,2,0" VerticalAlignment="Top" Width="14" Height="15" Source="../Images/close.png" Stretch="Fill" x:Name="CloseButton"/>
		<Image HorizontalAlignment="Right" Margin="0,3,20,0" VerticalAlignment="Top" Width="14" Height="15" Source="../Images/Maximize.png" Stretch="Fill" x:Name="Max"/>
		<Image HorizontalAlignment="Right" Margin="0,3.5,38,0" VerticalAlignment="Top" Width="14" Height="15" Source="../Images/Minimize.png" Stretch="Fill" x:Name="Min"/>
		<Image HorizontalAlignment="Left" Margin="4,2,0,0" VerticalAlignment="Top" Width="21" Height="21" Source="..\Images\mChat.ico" Stretch="Fill"/>
		<TextBox VerticalAlignment="Bottom" Height="20" Text="Enter message here, then press Enter to send it!" TextWrapping="Wrap" IsEnabled="True" TextAlignment="Center" x:Name="Message" Background="{DynamicResource TopRectBrush}" BorderBrush="{x:Null}" BorderThickness="0,0,0,0" Margin="1,0,0,0"/>
		<TextBox HorizontalAlignment="Left" Margin="36,109,0,0" Width="129" Text="" TextWrapping="Wrap" x:Name="HiddenTB" Visibility="Hidden" VerticalAlignment="Top" Height="101"/>
		<Button Style="{DynamicResource OptsButt}" Content="Channel Modes" BorderThickness="1,1,1,1" Background="#FF5C5C5D" x:Name="ShowChannelCenter" BorderBrush="#FF525252" FontFamily="Comic Sans MS" Foreground="#FF000000" HorizontalAlignment="Left" Width="96" RenderTransformOrigin="0.5,0.5" Height="21" Margin="172,25.25,0,0" VerticalAlignment="Top" IsEnabled="True" IsDefault="False" Visibility="Visible">
			<Button.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="0"/>
					<TranslateTransform X="0" Y="0"/>
				</TransformGroup>
			</Button.RenderTransform>
		</Button>
		<Button Style="{DynamicResource OptsButt}" Content="Log Viewer" BorderThickness="1,1,1,1" Background="#FF5C5C5D" x:Name="LogBrowser" BorderBrush="#FF525252" FontFamily="Comic Sans MS" Foreground="#FF000000" RenderTransformOrigin="0.5,0.5" Height="21" Margin="272,25.25,189,0" VerticalAlignment="Top" IsEnabled="True" IsDefault="False" Visibility="Visible">
			<Button.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="0"/>
					<TranslateTransform X="0" Y="0"/>
				</TransformGroup>
			</Button.RenderTransform>
		</Button>
		<r:TabControl Margin="2,37.25,3,20" IsSynchronizedWithCurrentItem="True" Background="{x:Null}" BorderBrush="#FFFFC901" TabItemMouseOverBackground="#FFD3D3D3" TabItemNormalBackground="#FF525252" TabItemSelectedBackground="#FF6E6E6E" x:Name="ChatTabs"/>
    </Grid>
</Window>